import java.util.Scanner;

public class Day_7_1_斐波那契 {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            int num = sc.nextInt();
            int step = fibonacci(num);
            System.out.println(step);
        }

    }

    public static int fibonacci(int num){
        int start = 0;
        int second = 1;
        int thard = 0;

        while(num > second){
            thard = second + start;
            start = second;
            second = thard;
        }
        if(Math.abs(second) < Math.abs(thard)){
            return Math.abs(second);
        }else{
            return Math.abs(thard);
        }

    }
}
